﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EntGuayasSLA.BL;
using Ext.Net;

namespace EGuayas.Web.Usuario
{
    public partial class wucCuenta : ucWuc
    {
        protected String IdPageSession
        {
            get
            {
              
                return ReadCustomConfigPage(this.frmCuenta, this.ID);
            }

        }

        /// <summary>
        /// Id de persona creada y/o modificada
        /// pgPromotorPersonaIdTmp
        /// </summary>
        protected string PersonaIdTmp
        {
            get
            {
                
                return ReadCustomConfig(this.frmCuenta, this.ID,"idPers");
            }
           
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }

        protected void CheckField(object sender, RemoteValidationEventArgs e)
        {
            try
            {
                //TextField field = (TextField)sender;
                string txtVal = e.Value.ToString();//field.Text
                int qty = Usuarios.VerificarLogin(txtVal, PersonaIdTmp);
                Boolean bReturn = false;
                if (qty==0)
                {
                    bReturn = true;
                }
                e.Success = bReturn;
                if (bReturn == false)
                    e.ErrorMessage = "'Usuario Similar' Modifique nombre de usuario";
                else
                    e.ErrorMessage = "";
                System.Threading.Thread.Sleep(1000);

            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
    }
}